# Maintainer: Peter Budai <peterbudai at hotmail dot com>

pkgname=po4a
pkgver=0.57
pkgrel=1
pkgdesc="The po4a (PO for anything) project goal is to ease translations (and more interestingly, the maintenance of translations) using gettext tools on areas where they were not expected like documentation"
arch=('any')
url="https://po4a.org/"
license=('GPL')
depends=("perl" "gettext" 'perl-Text-WrapI18N' 'perl-Locale-Gettext' 
         'perl-TermReadKey' 'perl-sgmls'
         'perl-Unicode-GCString')
makedepends=('perl-Module-Build' 'docbook-xsl')
options=('!emptydirs')
source=(https://github.com/mquinson/po4a/releases/download/v${pkgver}/${pkgname}-${pkgver}.tar.gz
        001-fix-man-names.patch)
sha256sums=('bb55ec2b419ec7eefb0f13752fb08bc2701e6689467b6e1994bb5d9ae711cd97'
            'b2dc4f9cd6aa1ee38fa5a32b6f36847c34d876ce8852011e462c2ce7c6149aff')

prepare() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  patch -p1 -i ${srcdir}/001-fix-man-names.patch
}

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"

  perl Build.PL INSTALLDIRS=vendor create_packlist=0
  # The script expects a UTF-8 locale
  LC_ALL=en_US.UTF-8 perl Build
}

package() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  perl Build destdir="${pkgdir}" install

  # remove perllocal.pod and .packlist
  find "${pkgdir}" -name .packlist -o -name perllocal.pod -delete
}
